#include "put_voice.h"

#define VOICE 17

void ultraInit(void)
{
    pinMode(VOICE,OUTPUT);//我们此处是用的是GPIO.0输入输出端口，所以pin=0 
    digitalWrite(VOICE,HIGH);
}

void doVoice(void)
{
	int i=0;
	while( i <= 60)
	{
	digitalWrite(VOICE,LOW);//设置引脚传出高电平 
	delay(500);
	digitalWrite(VOICE,HIGH);
	i++;
	}
}

int  buzzer_low(int read)
{
	int rv;
	if((rv = wiringPiSetupGpio()) == -1)
	{                //初始化树莓派 
		printf("setup wiringPi failed !");
		return -1;
	}

	ultraInit();                            //初始化端口 
	if(read == 10)
	{
		doVoice();    //控制蜂鸣器发声 
	} 
}
